<template>
    <div class="father">
        <h3>组父组件</h3>
        <p>我是爷爷，有{{money}}元钱</p>
      
        <Parent></Parent>
    </div>
</template>

<script setup lang="ts" name="GranndParent">
import { provide, ref } from 'vue';
import Parent from "@/components/demo7/Parent.vue";

let money = ref(1000)

provide('money',{money,updateMoney})

//同花钱方法
function updateMoney(params:number) {
    money.value -= params;
}


</script>

<style scoped>
.father {
    border: 1px solid #ccc;
    padding: 10px;
    margin: 10px 0;
    background-color: #f9f9f9;
}
</style>
